// pages/dy_details/dy_details.js
Page({
  data: {
    index: '',
    data: '',
    zzry:'',
    jjsy:'',
    dbTOP:'',
    at:'',
    search:'',
    scale:'',
    boo:true
  },
  onShow() {
    wx.setNavigationBarTitle({
      title: '电影详情'
    })
  },
  onLoad(options) {
    console.log(options)
    let idx = options.index
    let that = this;
    if(options.icon == 'zzry') {
      wx.getStorage({
        key: 'zzry',
        success(res) {
          console.log(res)
          that.setData({
            at:res.data[idx]
          })
        }
      })
    }else if(options.icon == 'jjsy') {
      wx.getStorage({
        key: 'jjsy',
        success(res) {
          that.setData({
            at: res.data[idx]
          })
        }
      })
      console.log(that.data.at)
    }
    else if(options.icon == 'search') {
      wx.getStorage({
        key: 'search',
        success(res) {
          that.setData({
            at: res.data[idx]
          })
        }
      })
      console.log(that.data.at)
    }
    else{
      wx.getStorage({
        key: 'dbTOP',
        success(res) {
          that.setData({
            at: res.data[idx]
          })
        }
      })
      console.log(that.data.at)
    }
  },
  scale(e) {
    wx.previewImage({
      urls: [e.currentTarget.dataset.url],
    })
  },
  scale2(e) {
    let arr = []; 
    for (let i = 0; i < this.data.at.casts.length; i++) {
      arr.push(this.data.at.casts[i].avatars.large)
    }
    arr.push(this.data.at.images.large)
    wx.previewImage({
      current: this.data.at.casts[e.target.id].avatars.large,
      urls: arr
    })
  },
  forr() {
    
  }
})